function(http_layer_find_openssl)
	if (TARGET http_layer_openssl_internal)
		return()
	endif ()

	set(OPENSSL_ROOT_DIR ${HTTPLAYER_3RD_OUTDIR}/openssl-1.1.1d)
	find_package(OpenSSL REQUIRED)

	INCLUDE(CheckCXXSourceCompiles)
	set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
	set(CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}")
	CHECK_CXX_SOURCE_COMPILES("
      #include <openssl/ssl.h>
      int main()
      {
      ::SSL_COMP_free_compression_methods();
      }
    " _SSL_LEAK_SUPPRESS_AVAILABLE)

	add_library(http_layer_openssl_internal INTERFACE)
	target_include_directories(http_layer_openssl_internal INTERFACE "$<BUILD_INTERFACE:${OPENSSL_INCLUDE_DIR}>")
	target_link_libraries(http_layer_openssl_internal INTERFACE "$<BUILD_INTERFACE:${OPENSSL_LIBRARIES}>")
endfunction()